package so.sao.code.service.infrastructure.enums;

import so.sao.top.core.util.enums.NamedEnumEntity;

public enum TAG_SCRAP_TYPE implements NamedEnumEntity<Integer> {
	SCRAPBYBATCH(1, "按批次报废"),

	SCRAPBYCODESEGMENT(2, "按码段报废"),
	
	SCRAPBYCODE(3, "单码报废"),

	SCRAPBYBOX(4, "按箱码报废");
	
	private Integer value;

	private String name;
	TAG_SCRAP_TYPE(Integer value, String name) {
		this.name = name;
		this.value = value;
	}

	@Override
	public Integer getValue() {
		return value;
	}

	@Override
	public String getName() {
		return name;
	}
	 public static TAG_SCRAP_TYPE fromValue(Integer id) {
	        switch (id) {
	            case 1:
	                return SCRAPBYBATCH;
	            case 2:
	                return SCRAPBYCODESEGMENT;
	            case 3:
	                return SCRAPBYCODE;
	            case 4:
	                return SCRAPBYBOX;
	            default:
	                throw new IllegalArgumentException("Value [" + id + "] not support!");
	        }
	    }
}
